package com.task.view;

import javax.faces.application.NavigationHandler;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class LoginBean {
	private String username;
	private String password;
	private String projectName;
	private String role;

	public String getProjectName() {

		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	private String error;
	private boolean renderError = false;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}

	public boolean isRenderError() {
		return renderError;
	}

	public void setRenderError(boolean renderError) {
		this.renderError = renderError;
	}

	public String doLogin() {
		this.error = "Login Failed!";
		this.renderError = true;
		this.role = "testRole";
		this.projectName = "Testproj";
		return "adminuser";
	}

	public String doLogout() {
		FacesContext.getCurrentInstance().getExternalContext()
				.invalidateSession();
		return "logout";
	}
}
